<script setup lang="ts">
import { ref } from 'vue'
import PersonalInfo from '@/components/personal-info/personal-info.vue'

// 自定义事件
const emit = defineEmits(['holdChange'])

const  isClose = ref(false)
function handleMenuIcon() {
  // 内部改变状态
  isClose.value = !isClose.value
  // 将事件和状态传递个父组件
  emit('holdChange', isClose.value)
}

</script>

<template>
  <div class="main-header">
    <div class="main-icon" @click="handleMenuIcon">
      <el-icon size="28px">
        <component :is="isClose ? 'Expand' : 'Fold'"/>
      </el-icon>
    </div>
    <div class="content">
      <div class="bread">面包屑</div>
      <PersonalInfo/>
    </div>
  </div>
</template>

<style scoped>
.main-header {
  display: flex;
  align-items: center;
  flex: 1;
  height: 100%;
  .main-icon {
    display: flex;
    align-items: center;
    cursor: pointer;
  }
  .content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
    padding: 0 18px;
  }
}

</style>
